<?php

namespace App\Service\Admin;

use App\Helpers\Utils;
use App\Model\AdminHasPermission;
use App\Model\AdminPermission;

class AuthService
{

    /**
     * 获取所有权限
     */
    public function allPermission($user)
    {
        $all = AdminPermission::with('children')->first()->toArray()['children'];

        $t = Utils::JsontoArray($user->permissions);

        return ['all_permission' => $all,'checked_permission' => $t];
    }
}